<?php

set_include_path(get_include_path() . PATH_SEPARATOR . '..');

require_once 'simpletest/autorun.php';
require_once 'components/data_filter.php';

class DataFilterTests extends UnitTestCase
{
    public function testSimpleDataReader()
    {
        $dataFilters = new DataFilters();

        $inputValues = new InputValuesStub(array(
            'filter0field' => 'id',
            'filter0value' => '1',
            'filter0operator' => '=',
        ));

        $dataFilters->ExtractFrom($inputValues);
        $this->assertEqual(1, $dataFilters->GetCount());

        $dataFilter = $dataFilters->GetFilter(0);
        $this->assertEqual('id', $dataFilter->GetFieldName());
        $this->assertEqual(FilterOperator::$Equlas->GetShortName(), $dataFilter->GetOperator()->GetShortName());
        $this->assertEqual(1, $dataFilter->GetValue());
    }
}

?>